#!/usr/bin/python

f = open("potions")

from collections import defaultdict
pots = defaultdict(set)
descs = {}
names = set()
potnames = set()
for line in f:
	value,other = line.split(":")
	name,other  = other.split("|")
	desc,other  = other.split("(")
	dur,other   = other.split("@")
	pot,other   = other.split(")")
	value = int(value.strip())
	name = name.strip()[7:]
	names.add(name)
	pot = int(pot.strip())
	dur = int(dur.strip())
	if pot > 0:
		potnames.add(name)
	descs[value] = desc[14:]

	pots[value].add((name,dur,pot))


revpots = defaultdict(list)

for k,v in pots.items():
	revpots[frozenset(v)].append(k)

